<%@ page language="java" import="java.util.*,com.opensymphony.xwork2.util.*" 
pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="json" uri="http://www.atg.com/taglibs/json" %>  

<!doctype html>
<html lang="zh-hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css">

<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/main.css">    
<script src="lib/jquery-2.1.1.min.js"></script>
<script src="lib/bootstrap/js/bootstrap.min.js"></script>
<title>HIFO</title>

<script type="text/javascript">
function tijiao(){
	//$("#opType").val(2);	
	document.form1.submit();
};


function select1() {
$.ajax(
{
    type: "post",
    url: "getProvince",
    //data: { "code": "" },
    success: function (msg) {
    	$("#S1").append("<option value="  + "0>" + "</option>");
        for (var i = 0; i < msg.length; i++) {
            $("#S1").append("<option value='" +msg[i].provinceId+ "'>" + msg[i].province + "</option>");
        }
        select2();
        
    }
})
};

function select2() {
$("#S2").html("");
$.ajax(
{
    type: "post",
    url: "getCity",
    data: {"code":$('#S1').val()},
    success: function (msg) {
    	$("#S2").append("<option value="  + "0>" + "</option>");
        for (var i = 0; i < msg.length; i++) {
            $("#S2").append("<option value=" + msg[i].cityId + ">" + msg[i].city + "</option>");
        }
        select3();
    }
})
};


$(function () {
select1();
$('#S1').bind("change", select2);
});


function check_phone(){ 	//check phone
	 $.ajax({ url:"check",
	 		data:{phoneName:$("#phone").val(),type:1}, 
	 		type:'post',
	        success: function(obj){
	        	if(obj.resultState<0){	//error
	        		$("#phoneTip").removeClass().addClass("input-group-addon");
	   			 	$("#phoneTip").html(obj.tip);
	   			 }
	   			else{
	   				$("#phoneTip").removeClass(); 					
	   				$("#phoneTip").html("");
	   			} 
	}});   
}



function check_name(){   //check name
	 $.ajax({ url:"check",
	 		data:{phoneName:$("#trueName").val(),type:2}, 
	 		type:'post',
	        success: function(obj){
	        	if(obj.resultState<0){	//error
	   			 	//alert(obj.tip);
	        		$("#trueNameTip").removeClass().addClass("input-group-addon");
	   			 	$("#trueNameTip").html(obj.tip);
	   			 }
	   			else{
	   				$("#trueNameTip").removeClass();
	   				$("#trueNameTip").html("");
	   			}				 
	}});   
};
</script>
</head>



<body>

<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h5 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
汇发机械员工注册（请务必填写真实信息）
</a>
</h5>
</div>

<div class="panel-body khdetail">
           
<!-- #################注册信息###################  -->
<form name="form1" action="regist" method ="post">
<div class="form-group">  

<!-- hide openId nickname headurl -->
<div class="input-group hide">
<input type="text" class="form-control" name="refreshToken" readonly="readonly" value="<s:property value="refreshToken"/>">
<input type="text" class="form-control" name="accessToken" readonly="readonly" value="<s:property value="accessToken"/>">
<input type="text" class="form-control" name="openId" value="<s:property value="openId"/>">
</div>

<div class="input-group">
<div class="input-group-addon"><img class="home" src="images/name.png"></div>
<input type="text" class="form-control" id="trueName" name="trueName" placeholder="真实姓名" value="<s:property value="trueName"/>"  onChange="check_name()">
<span class="" id="trueNameTip"></span>
</div>

<div class="input-group">
<div class="input-group-addon"><img class="home" src="images/phone.png"></div>
<input type="text" class="form-control" id="phone" name="phone" placeholder="常用电话" value="<s:property value="phone"/>"  onChange="check_phone()">
<span class="" id="phoneTip"></span>
</div> 

<div class="input-group">
<div class="input-group-addon">分公司</div>
<s:select name="company" cssClass="form-control" list="#{'x':'请选择','a':'集团','b':'汇发','c':'合锦','d':'恒安'}" listKey="key" listValue="value" />
<!-- <input type="text" class="form-control" id="company" name="company" placeholder="分公司名称" value="<s:property value="company"/>" > -->

</div>
     
<div class="input-group">
<div class="input-group-addon">所在省</div>
<select class="form-control" id="S1" name="provinceId">
	
</select>
</div>
    
<div class="input-group">
<div class="input-group-addon">所在市</div>
<select class="form-control" id="S2" name="cityId">

</select>
</div>
 

<input type="button" class="btn btn-primary pull-right" value="确定提交"  onClick="tijiao()"  />


</div><!--form-group-->
</form>
      
     
</div>
</div>


			

</body>
</html>